    package com.ruoyi.web.controller.project;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.project.domain.entity.ProjectAccounting;
import com.ruoyi.project.domain.entity.ProjectGoods;
import com.ruoyi.project.domain.query.ProjectAccountingQuery;
import com.ruoyi.project.domain.query.ProjectGoodsQuery;
import com.ruoyi.project.service.IProjectAccountingService;
import com.ruoyi.project.service.IProjectGoodsService;
import com.ruoyi.web.controller.LogApi;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

    @RestController
    @RequestMapping("/project/goods")
    @Api(tags = "项目信息", description = "项目基本信息")
    public class ProjectGoodsController extends BaseController {

        @Resource
        private IProjectGoodsService projectGoodsService;

        @ApiOperation("列表")
        @GetMapping(value = "/list")
        public R getList(ProjectGoodsQuery query) {
            System.out.println(query);
            return R.ok(projectGoodsService.getList(query));
        }

        @LogApi(module = "采购查询", description = "分页查询库存信息")
        @GetMapping(value = "/page")
        public TableDataInfo getListPage(ProjectGoodsQuery query) {
            return projectGoodsService.getListPage(query);
        }

        @ApiOperation("新增")
        @PostMapping(value = "/save")
        public R add(@RequestBody ProjectGoods project) {
            return R.ok(projectGoodsService.addInfo(project));
        }


        @ApiOperation("修改")
        @PutMapping (value = "/update")
        public R update(@RequestBody ProjectGoods project) {
            return R.ok(projectGoodsService.updateInfo(project));
        }


        @ApiOperation("删除")
        @DeleteMapping (value = "/{id}")
        public R delete(  @PathVariable("id") String id) {
            return R.ok(projectGoodsService.deleteInfo(id));
        }



        @ApiOperation("详情")
        @GetMapping(value = "/details")
        public R<ProjectGoods> getDetails(@RequestParam String id) {
            return R.ok(projectGoodsService.getById(id));
        }




    }
